<?php
class Admin_Acl_Access_Create_Action extends NICED_Action 
{       
	public function execute() 
	{
        $this->forward("admin.index");

		$controller = $this->getController();
		$request    = $controller->getRequest();			
        $name       = $request->loadParam("name", NULL, "safe");
        $parent_id  = $request->loadParam("parent_id", 0, "posint");
        $type_id    = $request->loadParam("type_id", 1, "posint");
        $link       = $request->loadParam("link", NULL, "safe");
        $act        = $request->loadParam("act", NULL, "safe");

		try
		{
            //if no act param, show create page
            if (!$act)
            {
                return self::SUCCESS;
            }

            $model      = $controller->getModel('Admin.Acl.Access.Index');
            $model->create($name, $parent_id, $type_id, $link);
        }
        catch (Exception $e)
		{
			$controller->handleException($e);
			return self::SUCCESS;
		}

		return self::SUCCESS;
	}

}//end class
